package com.zr.service.intelligent.impl;

import com.zr.dao.base.BaseCityDao;
import com.zr.service.intelligent.TransitPathService;
import com.zr.utils.TransitPathUtil;
import com.zr.vo.base.BaseCity;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author Administrator
 */
@Service
public class TransitPathServiceImpl implements TransitPathService {
    @Resource
    private BaseCityDao baseCityDao;


    @Override
    public Map<String, Object> getShortestPath(List<Integer> cityIds) {
        List<BaseCity> cityList=new ArrayList<>();
        List<BaseCity> shortestPathCityList=new ArrayList<>();
        for (Integer cityId:cityIds) {
            cityList.add(baseCityDao.selectByPrimaryKey(cityId));
        }
        TransitPathUtil transitPathUtil = new TransitPathUtil();
        Map<String,Object> map=new HashMap<>();
        map=transitPathUtil.getShortestPathCityList(cityList);
        return map;
    }
}
